package com.apollographql.apollo.api.internal;

public class Functions {
    public static <E> Function<E, E> identity() {
        return (Function<E, E>) IdentityFunction.INSTANCE;
    }

    private enum IdentityFunction implements Function<Object, Object> {
        INSTANCE;

        @Override // com.apollographql.apollo.api.internal.Function
        public Object apply(Object o) {
            return o;
        }

        public String toString() {
            return "Functions.identity()";
        }
    }

    public static Function<Object, String> toStringFunction() {
        return ToStringFunction.INSTANCE;
    }

    private enum ToStringFunction implements Function<Object, String> {
        INSTANCE;

        @Override // com.apollographql.apollo.api.internal.Function
        public String apply(Object o) {
            Utils.checkNotNull(o);
            return o.toString();
        }

        public String toString() {
            return "Functions.toStringFunction()";
        }
    }
}
